package edu.sctu.zhuyingzhi.month201505.day20150520.listTest;


import java.util.ArrayList;
import java.util.List;


/**
 * Created by user11 on 2015/5/17.
 */
public class TextMore {

    public List<Teacher> sotrNumber(){
        Teachers teacher = new Teachers();
        List<Teacher> list = teacher.tea();





        for (int i = 0; i < list.size()-1; i++) {

            for (int j = 0; j < list.size()-1; j++) {

                if (list.get(j).getNumber()>list.get(j+1).getNumber()) {

                    list.add(j, list.get(j + 1));

                    list.remove(j+2);



                }
            }
        }

        System.out.println("1111");
        return list;

    }

    public void sortStudent(){
        Teachers teacher1 = new Teachers();
        List<Teacher> list = teacher1.tea();

        List<Student> list1 = new ArrayList<>();

        for (int i = 0; i < list.size(); i++) {
            for (int j = 0; j < list.get(i).getStudent().size(); j++) {
                list1.add(list.get(i).getStudent().get(j));
            }
        }

       Student student;
        for (int i = 0; i < list1.size(); i++) {
            for (int j = 0; j < list1.size();j++) {
                if (list1.get(j).getNumber()>list1.get(j+1).getNumber()) {
                    student = list1.get(j);
                    list1.add(j,list1.get(j + 1));
                    list1.add(j+1,student);

                }
            }
        }



    }

    public List<Teacher> pritCoded(){
        Teachers teacher2 = new Teachers();

        List<Teacher> list = teacher2.tea();
        List<Teacher> list1 = new ArrayList<>();


        for (int i = 0; i < list.size(); i++) {

            if (list.get(i).getTitle().equals("教授")){

                list1.add(list.get(i));
            }
        }

        return list1;

    }
}
